﻿using System;
using System.Collections.Generic;
using System.Data.Entity.Infrastructure;
using System.Data.Objects;
using System.Linq;
using System.Text;
using System.Data.Entity;
using ICore;

namespace EntityFrameWorkAccess
{
    public class DinnerContext : DbContext
    {
        public DbSet<User> Users { get; set; }
        public DbSet<Dinner> Dinners { get; set; }
        public DbSet<Category> Categories { get; set; }

        public ObjectContext ObjectContext
        {
            get { return ((IObjectContextAdapter)this).ObjectContext; }
        }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            Database.SetInitializer(new DropCreateDatabaseIfModelChanges<DinnerContext>());
            base.OnModelCreating(modelBuilder);
        }
    }
}
